/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package ejercicio2;
import java.util.Scanner;

/**
 *
 * @author Alejandro
 */
public class ejercicio12 {
    static int contarMayusculas(String cad) {
        int Mayus = 0; //mayusculas ASCII: 65 - 90 Y 165
        for(int i=0;i<cad.length();i++) {
            if((int)cad.charAt(i) >= 65 && (int)cad.charAt(i) <= 90 || (int)cad.charAt(i) == 165) {
                Mayus++;
            }
        }
        return Mayus;
    }
    static int contarMinusculas(String cad) {
        int Minus = 0; //minusculas ASCII: 97 - 122 Y 164
        for(int i=0;i<cad.length();i++) {
            if((int)cad.charAt(i) >= 97 && (int)cad.charAt(i) <= 122 || (int)cad.charAt(i) == 164) {
                Minus++;
            }
        }
        return Minus;
    }
    public static void main(String[] args)  {
        Scanner reader = new Scanner(System.in);
        String cadena;
        System.out.print("Introduce cadena: ");
        cadena = reader.nextLine();
        System.out.println("\n\nCadena introducidad: " + cadena);
        System.out.println("Mayusculas: " + contarMayusculas(cadena));
        System.out.println("Minusculas: " + contarMinusculas(cadena));
    }
}
